package edu.njust.dao;

import edu.njust.pojo.*;
import org.apache.ibatis.annotations.Param;

import java.sql.Date;
import java.sql.Time;
import java.util.List;

public interface ReservationMapper {

    //--------------------上课预定表--------------------

    //获取所有Item
    List<KlassReservation> getAllKlassReservation();

    //通过课程list查预订list
    List<KlassReservation> getKlassReservationListByCourseList(List<Course> courseList);

    //通过时间和序号查预订list
    List<KlassReservation> getKlassReservationListByTimeAndNum(@Param("date") Date date, @Param("num") Integer num);

    //通过老师id查询预订list
    List<KlassReservation> getKlassReservationListByTeacherId(String teacher_id);

    //增加上课预约
    void addKlassReservation(@Param("klassReservation") KlassReservation klassReservation);

    //取消上课预约
    void quitKlassReservation(Long id);

    //通过预约名称查询预约list
    List<KlassReservation> getKlassReservationListByName(String name);

    //
    //通过日期查询预约list
    List<KlassReservation> getKlassReservationListByDateAndTime(@Param("date")Date date,@Param("time_num")Integer time_num);

    //通过日期和课程列表查询预约list
    List<KlassReservation> getKlassReservationListByDateAndCourseList(@Param("date") Date date, @Param("list") List<Course> courseList);

    //id查询预约list
    KlassReservation getKlassReservationById(Long id);


    //通过日期、课程列表、时间段查询预约list
    List<KlassReservation> getKlassReservationListByDateCourseListAndTimeNum(@Param("date") Date date,@Param("list") List<Course> courseList,@Param("num") Integer num);

    // 通过课程idList、老师idList、日期查询预约list(用like语句)
    List<KlassReservation> getKlassReservationListByInformation(@Param("name") String name, @Param("teacherIdList") List<String> teacherIdList, @Param("date") String date);

    //--------------------考试预定表--------------------

    //获取所有考试
    List<ExamReservation> getAllExamReservation();

    //通过课程list查考试预订list
    List<ExamReservation> getExamReservationListByCourseList(List<Course> courseList);

    //通过时间和序号查预订list
    List<ExamReservation> getExamReservationListByTimeAndNum(@Param("date")Date date, @Param("num")Integer num);

    //id查询预约list
    ExamReservation getExamReservationById(Long id);

    //增加考试预约
    void addExamReservation(@Param("examReservation")ExamReservation examReservation);

    //取消考试预约
    void quitExamReservation(Long id);

    //通过预约名称查询考试预约list
    List<ExamReservation> getExamReservationListByName(String name);

    //通过日期查询预约list
    List<ExamReservation> getExamReservationListByDateAndTime(@Param("date")Date date,@Param("time_num")Integer time_num);

    //通过日期和课程list查询考试预约list
    List<ExamReservation> getExamReservationListByDateAndCourseList(@Param("date") Date date,@Param("list") List<Course> courseList);


    //通过日期、时间段、课程list查询考试预约list
    List<ExamReservation> getExamReservationListByDateCourseListAndTimeNum(@Param("date") Date date,@Param("list") List<Course> courseList,@Param("num") Integer num);


    //--------------------开放性实验表--------------------
    //通过日期查询开放性实验
    List<LabReservation> getLabReservationListByDate(Date date);

    // 显示所有开放性实验
    List<LabReservation> showAllLabReservationList();

    //id查询预约list
    LabReservation getLabReservationById(Long id);

    //取消开放性实验预约
    void quitLabReservation(Long id);

    //增加开放性实验预约
    void addLabReservation(@Param("labReservation")LabReservation labReservation);

    // 通过开放性实验id查开放性实验
    LabReservation getLabReservationListById(@Param("id") Long reservation_id);

    //更新开放性实验人数
    void updateLabReservation(@Param("labReservation") LabReservation labReservation);

    //找到Reservation表里最后一条数据的id
    Long getLastReservationId();

    //--------------------比赛预约表---------------------
    //添加比赛
    Integer addCompetitionReservation(@Param("competitionReservation")CompetitionReservation competitionReservation);

    //取消比赛
    Integer quitCompetitionReservation(Long reservation_id);

    //通过日期查询比赛
    List<CompetitionReservation> getCompetitionByDate(Date date);


    // 显示所有比赛
    List<CompetitionReservation> showAllCompetitionReservationList();

    //id查询预约list
    CompetitionReservation getCompetitionReservationById(Long id);

    //--------------------预订item表--------------------

    //获取所有Item
    List<ReservationItem> getAllReservationItem();

    // 通过预约列表查询item列表
    List<ReservationItem> getReservationItemList(List<Reservation> reservationList);

    //通过班级Id查找itemList
    List<ReservationItem> getItemListByKlassIdAndType(@Param("klass_id") String klass_id,@Param("type") Integer type);

    //通过ItemID查Item
    ReservationItem getReservationItemByItemId(Long item_id);

    //通过预约id查询item列表
    List<ReservationItem> getItemListByReservationId(List<Long> reservation_id);

    // 取消预约item列表
    boolean quitReservationItem(List<Long> reservationItemIdList);

    //更新item
    Integer updateReservationItem(@Param("reservationItem") ReservationItem reservationItem);

    //通过预订id查机房id
    String getComputerRoomIdByReservationId(Long id);

    //增加预约item
    void addReservationItem(@Param("reservationItem")ReservationItem reservationItem);

    //找到ReservationItem表里最后一条数据的id
    Long getLastReservationItemId();
}
